﻿@*
//***********************************************************************************//
// Autor:  				                						     				*//
//***********************************************************************************//
// SearchIndex()		Acceso INVITADO	y ADMINISTRADOR		    					*//
// Vista que permite visualizar todos los usuarios del sistema, tanto los empleado	*// 
// de MONACA como los externos.                                                     *//
// _________________________________________________________________________________*//
*@

@model PagedList.IPagedList<SIBI.Models.Cargo>
@using SIBI.Helpers
@{
    ViewBag.Title = "Cargos/Usuarios";
}

<h2>Cargos/Usuarios</h2>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

    @using (Html.BeginForm()){   
            <table width="100%">
                    <tr>
                        <td> 
                            Empleado:<br /> @Html.TextBox("SearchEmp", ViewBag.CurrentEmp as string) &nbsp;
                        </td>
                        <td>   
                            Centro de Costo:<br /> @Html.TextBox("SearchNPer", ViewBag.CurrentNper as string) &nbsp;
                        </td>
                        <td>
                            Cargo: <br /> @Html.TextBox("SearchPos", ViewBag.CurrentPos as string) &nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td>
                            División:<br /> @Html.TextBox("SearchIdPos", ViewBag.CurrentIdPos as string) &nbsp;
                        </td>
                    </tr>
            </table>
         <input type="submit" value="Filtrar" />
    }
<table width="100%">
    <tr>
        <th>
            Empleado
        </th>
        <th>
            División
        </th>
        <th>
            Cargo
        </th>
        <th>
            Centro Costo
        </th>
        <th>
            Correo
        </th>
        <th></th>
        <th></th>
    </tr>

@foreach (var item in Model)
{
    <tr>
        <td>
            @if(item.empleados == " "){
                @:Vacante
            }else{
                 @Html.UppercaseFirst(@Html.DisplayFor(modelItem => item.empleados).ToString())
            }
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.division)
        </td>
        <td>
            @Html.UppercaseFirst(@Html.DisplayFor(modelItem => item.cdes).ToString())
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.ceco)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.correo)
        </td>
        <td>
            @Html.ActionLink("Detalles", "Details", new { id=item.CargoId })
        </td>
    </tr>
}

</table>
<br />

<div>
    Pag @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber)
    de @Model.PageCount
    &nbsp;
    @if (Model.HasPreviousPage)
    {
        @Html.ActionLink("<<= ", "SearchIndex", new { page = 1, currentNPer = ViewBag.CurrentNPer, currentEmp = ViewBag.CurrentEmp, currentIdPos = ViewBag.CurrentIdPos, currentPos = ViewBag.CurrentPos })
        @Html.Raw("&nbsp;");
        @Html.ActionLink("<=", "SearchIndex", new { page = Model.PageNumber - 1, currentNPer = ViewBag.CurrentNPer, currentEmp = ViewBag.CurrentEmp, currentIdPos = ViewBag.CurrentIdPos, currentPos = ViewBag.CurrentPos })
    }
    else
    {
        @:<<=
        @Html.Raw("&nbsp;");
        @:<=
    }
    &nbsp;
    @if (Model.HasNextPage)
    {
        @Html.ActionLink("=>", "SearchIndex", new { page = Model.PageNumber + 1, currentNPer = ViewBag.CurrentNPer, currentEmp = ViewBag.CurrentEmp, currentIdPos = ViewBag.CurrentIdPos, currentPos = ViewBag.CurrentPos })
        @Html.Raw("&nbsp;");
        @Html.ActionLink(" =>>", "SearchIndex", new { page = Model.PageCount, currentNPer = ViewBag.CurrentNPer, currentEmp = ViewBag.CurrentEmp, currentIdPos = ViewBag.CurrentIdPos, currentPos = ViewBag.CurrentPos })
    }
    else
    {
        @:=>
        @Html.Raw("&nbsp;")
        @:=>>
    }
</div>